<template>
  <div class="container">
    <a-list>
      <template #header>锻造工艺列表</template>
      <a-list-item v-for="(item,index) in state.dz_gongyichecked" :key="item.id">
        {{item.name}}
      </a-list-item>
    </a-list>

    <a-list>
      <template #header>缓冷工艺列表</template>
      <a-list-item v-for="(item,index) in state.hl_gongyichecked" :key="item.id">
        {{item.name}}
      </a-list-item>
    </a-list>

    <a-list>
      <template #header>机加工艺列表</template>
      <a-list-item v-for="(item,index) in state.jj_gongyichecked" :key="item.id">
        {{item.name}}
      </a-list-item>
    </a-list>
  </div>
</template>

<script lang="ts" setup>
import axios from "axios";
import { reactive, ref, onMounted, onUnmounted, defineAsyncComponent, defineProps } from "vue";
import GongYiType from "@/utils/gongYiType";

let props = defineProps({
  caizhiid : {type : Number, default: 0}
})
const state = reactive({
  dz_gongyichecked : [],
  hl_gongyichecked : [],
  jj_gongyichecked : [],
})
const loadDZGongYiByCaiZhi = ()=>{
  axios.post('/gongyi/listcaizhigongyi', {id : props.caizhiid, gongyitype:GongYiType.duanzao}).then(res => {
    const { data } = res
    state.dz_gongyichecked = data
  })
}
const loadHLGongYiByCaiZhi = ()=>{
  axios.post('/gongyi/listcaizhigongyi', {id : props.caizhiid, gongyitype:GongYiType.huanleng}).then(res => {
    const { data } = res
    state.hl_gongyichecked = data
  })
}
const loadJJGongYiByCaiZhi = ()=>{
  axios.post('/gongyi/listcaizhigongyi', {id : props.caizhiid, gongyitype:GongYiType.jijia}).then(res => {
    const { data } = res
    state.jj_gongyichecked = data
  })
}
onMounted(()=>{
  loadDZGongYiByCaiZhi();
  loadHLGongYiByCaiZhi();
  loadJJGongYiByCaiZhi();
})
onUnmounted(()=>{

})
</script>

<style scoped>

</style>
